package vip.xiaonuo.smzq.modular.jsc.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.jsc.entity.Kczyly;
import vip.xiaonuo.smzq.modular.jsc.service.IKczylyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


/**
 * 驾驶舱矿产资源利用统计
 *
 * @author sqq
 * @since 2024-05-13
 */
@Api(tags = "驾驶舱矿产资源利用统计")
@RestController
@RequestMapping("/jsc/kczyly")
@Validated
public class KczylyController {

    @Resource
    private IKczylyService iKczylyService;

    /**
     * 添加驾驶舱矿产资源利用统计
     */
    @ApiOperation("添加驾驶舱矿产资源利用统计")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid Kczyly kczyly) {
        iKczylyService.add(kczyly);
        return CommonResult.ok();
    }

    /**
     * 删除驾驶舱矿产资源利用统计
     */
    @ApiOperation("删除驾驶舱矿产资源利用统计")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iKczylyService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑驾驶舱矿产资源利用统计
     */
    @ApiOperation("编辑驾驶舱矿产资源利用统计")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid Kczyly kczyly) {
        iKczylyService.updateById(kczyly);
        return CommonResult.ok();
    }

    /**
     * 驾驶舱矿产资源利用统计分页查询
     */
    @ApiOperation("驾驶舱矿产资源利用统计查询")
    @GetMapping("/kczylyList")
    public CommonResult<List<Kczyly>> kczylyList(Integer nd, String xzqhdm) {
        return CommonResult.data(iKczylyService.kczylyList(nd, xzqhdm));
    }
}
